package com.dyrj.jzb.service.impl;


import com.alibaba.fastjson.JSON;
import com.dyrj.jzb.po.*;
import com.dyrj.jzb.service.JzbApiService;
import com.dyrj.ysk.configuration.SdkProperties;
import com.dyrj.ysk.util.FakeDataUtil;
import com.pabank.sdk.PABankSDK;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;


@Service
@Log4j2
public class JzbApiServiceImpl implements JzbApiService {

    @Resource
    private SdkProperties sdkProperties;

    //资金汇总账号（FundSummaryAcctNo） 监管账户----平安银行电子商务交易资金待清算专户(乐彩农牧生猪采购平台)
    //商户号（MrchCode）
    //文件传输用户名（用户短号）uid

    @Override
    public Po6000OpenCustAcctId Api6000OpenCustAcctId(String tranNetMemberCode, String userNickname,String mobile, String email) {
        Po6000OpenCustAcctId rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6000OpenCustAcctId para = new Po6000OpenCustAcctId();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());
            //功能标志 1:开户  3:销户  4: 为存量见证子帐号申请智能收款子账号
            para.setFunctionFlag("1");
            //交易网会员代码 平台端的用户ID，需要保证唯一性，可数字字母混合，如HY_120，若需要开通智能收款要求后6位是数字，该6位数字为智能收款账号后6位，因账号前几位固定故后6位不能重复。
            para.setTranNetMemberCode(tranNetMemberCode);
            //会员属性 00-普通子账户(默认)  SH-商户子账户
            para.setMemberProperty("00");
            //用户昵称
            para.setUserNickname(userNickname);
            //手机号码
            para.setMobile(mobile);
            //邮箱
            para.setEmail(email);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"OpenCustAcctId");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6000OpenCustAcctId.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6092QueryCustAcctIdByThirdCustId Api6092QueryCustAcctIdByThirdCustId(String tranNetMemberCode) {
        Po6092QueryCustAcctIdByThirdCustId rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6092QueryCustAcctIdByThirdCustId para = new Po6092QueryCustAcctIdByThirdCustId();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //交易网会员代码 平台端的用户ID，需要保证唯一性，可数字字母混合，如HY_120，若需要开通智能收款要求后6位是数字，该6位数字为智能收款账号后6位，因账号前几位固定故后6位不能重复。
            para.setTranNetMemberCode(tranNetMemberCode);
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"QueryCustAcctIdByThirdCustId");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6092QueryCustAcctIdByThirdCustId.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6066BindRelateAcctUnionPay Api6066BindRelateAcctUnionPay(String subAcctNo, String tranNetMemberCode, String memberName, String memberGlobalType, String memberGlobalId, String memberAcctNo, String bankType, String acctOpenBranchName, String cnapsBranchId, String eiconBankBranchId, String mobile) {
        Po6066BindRelateAcctUnionPay rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6066BindRelateAcctUnionPay para = new Po6066BindRelateAcctUnionPay();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //见证子账户的户名
            para.setMemberName(memberName);
            //会员证件类型
            para.setMemberGlobalType(memberGlobalType);
            //会员证件号码
            para.setMemberGlobalId(memberGlobalId);
            //会员的待绑定账户的账号
            para.setMemberAcctNo(memberAcctNo);
            //会员的待绑定账户的本他行类型
            para.setBankType(bankType);
            //会员的待绑定账户的开户行名称
            para.setAcctOpenBranchName(acctOpenBranchName);
            //会员的待绑定账户的开户行的联行号
            para.setCnapsBranchId(cnapsBranchId);
            //会员的待绑定账户的开户行的超级网银行号
            para.setEiconBankBranchId(eiconBankBranchId);
            //会员的手机号
            para.setMobile(mobile);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"BindRelateAcctUnionPay");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6066BindRelateAcctUnionPay.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6067BindRelateAccReUnionPay Api6067BindRelateAccReUnionPay(String subAcctNo, String tranNetMemberCode, String memberAcctNo, String messageCheckCode) {
        Po6067BindRelateAccReUnionPay rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6067BindRelateAccReUnionPay para = new Po6067BindRelateAccReUnionPay();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //会员的待绑定账户的账号
            para.setMemberAcctNo(memberAcctNo);
            //短信验证码
            para.setMessageCheckCode(messageCheckCode);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"BindRelateAccReUnionPay");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6067BindRelateAccReUnionPay.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    //TODO 数组处理
    public Po6098MemberBindQuery Api6098MemberBindQuery(String subAcctNo) {
        Po6098MemberBindQuery rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6098MemberBindQuery para = new Po6098MemberBindQuery();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //查询标志 2：普通会员子账号 3：功能子账号
            para.setQueryFlag("2");
            //页码 起始值为1，每次最多返回20条记录，第二页返回的记录数为第21至40条记录，第三页为41至60条记录，顺序均按照建立时间的先后
            para.setPageNum("1");
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"MemberBindQuery");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6098MemberBindQuery.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6138MntMbrBindRelateAcctBankCode Api6138MntMbrBindRelateAcctBankCode(String subAcctNo, String memberBindAcctNo, String acctOpenBranchName, String cnapsBranchId, String eiconBankBranchId) {
        Po6138MntMbrBindRelateAcctBankCode rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6138MntMbrBindRelateAcctBankCode para = new Po6138MntMbrBindRelateAcctBankCode();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //会员绑定账号
            para.setMemberBindAcctNo(memberBindAcctNo);
            //开户行名称
            para.setAcctOpenBranchName(acctOpenBranchName);
            //大小额行号
            para.setCnapsBranchId(cnapsBranchId);
            //超级网银行号
            para.setEiconBankBranchId(eiconBankBranchId);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"MntMbrBindRelateAcctBankCode");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6138MntMbrBindRelateAcctBankCode.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6065UnbindRelateAcct Api6065UnbindRelateAcct(String subAcctNo, String tranNetMemberCode, String memberAcctNo) {
        Po6065UnbindRelateAcct rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6065UnbindRelateAcct para = new Po6065UnbindRelateAcct();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //功能标志 1：解绑
            para.setFunctionFlag("1");
            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //见证子账户的名称
            para.setMemberAcctNo(memberAcctNo);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"UnbindRelateAcct");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6065UnbindRelateAcct.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6010CustAcctIdBalanceQuery Api6010CustAcctIdBalanceQuery(String subAcctNo) {
        Po6010CustAcctIdBalanceQuery rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6010CustAcctIdBalanceQuery para = new Po6010CustAcctIdBalanceQuery();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //查询标志 2：普通会员子账号 3：功能子账号
            para.setQueryFlag("2");
            //页码 起始值为1，每次最多返回20条记录，第二页返回的记录数为第21至40条记录，第三页为41至60条记录，顺序均按照建立时间的先后
            para.setPageNum("1");
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"CustAcctIdBalanceQuery");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6010CustAcctIdBalanceQuery.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6037QueryCustAcctId Api6037QueryCustAcctId(String tranNetMemberCode){
        Po6037QueryCustAcctId rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6037QueryCustAcctId para = new Po6037QueryCustAcctId();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //市场的会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"QueryCustAcctId");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6037QueryCustAcctId.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6082ApplicationTextMsgDynamicCode Api6082ApplicationTextMsgDynamicCode(String subAcctNo, String tranNetMemberCode, String tranType, String tranAmt, String bankCardNo, String orderNo) {
        Po6082ApplicationTextMsgDynamicCode rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6082ApplicationTextMsgDynamicCode para = new Po6082ApplicationTextMsgDynamicCode();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //交易类型 1：提现 2：支付 3：批次号支付 4：批次号作废
            para.setTranType(tranType);
            //交易金额 按批次号提现时非必输
            para.setTranAmt(tranAmt);
            //银行卡号
            para.setBankCardNo(bankCardNo);
            //订单号 按批次号提现时，此字段必须，上送批次号字段
            para.setOrderNo(orderNo);
            //备注 建议可送订单号，可在对账文件的备注字段获取到。
            para.setRemark(orderNo);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"ApplicationTextMsgDynamicCode");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6082ApplicationTextMsgDynamicCode.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6085MemberWithdrawCash Api6085MemberWithdrawCash(String subAcctNo, String tranNetMemberCode, String subAcctName, String takeCashAcctNo, String takeCashAcctName, String cashAmt, String takeCashCommission, String messageOrderNo, String messageCheckCode){
        Po6085MemberWithdrawCash rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6085MemberWithdrawCash para = new Po6085MemberWithdrawCash();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //见证子账户的户名
            para.setSubAcctName(subAcctName);
            //收款账户的账号
            para.setTakeCashAcctNo(takeCashAcctNo);
            //收款账户的户名
            para.setTakeCashAcctName(takeCashAcctName);
            //币种
            para.setCcy("RMB");
            //申请提现的金额
            para.setCashAmt(cashAmt);
            //市场收取的手续费
            para.setTakeCashCommission(takeCashCommission);
            //短信验证码指令号 需与申请短信码时一致。
            para.setMessageOrderNo(messageOrderNo);
            //短信验证码
            para.setMessageCheckCode(messageCheckCode);
            //备注
            para.setRemark("");
            //保留域
            para.setReservedMsg("");
            //网银签名
            para.setWebSign("");

            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"MemberWithdrawCash");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6085MemberWithdrawCash.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6110SingleTransactionStatusQuery Api6110SingleTransactionStatusQuery(String subAcctNo, String functionFlag, String tranNetSeqNo, String tranDate) {
        Po6110SingleTransactionStatusQuery rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6110SingleTransactionStatusQuery para = new Po6110SingleTransactionStatusQuery();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //功能标志 2：会员间交易 3：提现 4：充值
            para.setFunctionFlag(functionFlag);
            //交易网流水号 提现，充值或会员交易请求时的CnsmrSeqNo值
            para.setTranNetSeqNo(tranNetSeqNo);
            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //交易日期
            para.setTranDate(tranDate);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"SingleTransactionStatusQuery");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6110SingleTransactionStatusQuery.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6048BankWithdrawCashBackQuery Api6048BankWithdrawCashBackQuery(String functionFlag, String startDate, String endDate, String pageNum) {
        Po6048BankWithdrawCashBackQuery rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6048BankWithdrawCashBackQuery para = new Po6048BankWithdrawCashBackQuery();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //功能标志 1-提现退票 2-小额鉴权退票
            para.setFunctionFlag(functionFlag);
            //开始日期 若是指定时间段查询，则必输，当查询全部时，不起作用	格式：20181201
            para.setStartDate(startDate);
            //终止日期 若是指定时间段查询，则必输，当查询全部时，不起作用
            para.setEndDate(endDate);
            //页码 起始值为1
            para.setPageNum(pageNum);
            //保留域
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"BankWithdrawCashBackQuery");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6048BankWithdrawCashBackQuery.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6145AccountRegulation Api6145AccountRegulation(String orderNo, String subAcctNo, String tranNetMemberCode, String subAcctName, String amt, String ccy, String remark) {
        Po6145AccountRegulation rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6145AccountRegulation para = new Po6145AccountRegulation();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //收单渠道类型 根据不同收单渠道上送 01-橙E收款 02-跨行快收（非T0） 03-跨行快收（T0） 04-聚合支付 YST1-云收款
            para.setAcquiringChannelType("YST1");
            //订单号 下单时的子订单号，不是总订单号
            para.setOrderNo(orderNo);
            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //见证子账户的名称
            para.setSubAcctName(subAcctName);
            //金额
            para.setAmt(amt);
            //币种 默认：RMB
            para.setCcy(ccy);
            //备注
            para.setRemark(remark);
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"AccountRegulation");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6145AccountRegulation.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6146ChargeDetailQuery Api6146ChargeDetailQuery(String orderNo) {
        Po6146ChargeDetailQuery rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6146ChargeDetailQuery para = new Po6146ChargeDetailQuery();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //收单渠道类型 根据不同收单渠道上送 01-橙E收款 02-跨行快收（非T0） 03-跨行快收（T0） 04-聚合支付 YST1-云收款
            para.setAcquiringChannelType("YST1");
            //订单号 下单时的子订单号，不是总订单号
            para.setOrderNo(orderNo);
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"ChargeDetailQuery");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6146ChargeDetailQuery.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6147PlatformAccountSupply Api6147PlatformAccountSupply(String orderNo, String amt) {
        Po6147PlatformAccountSupply rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6147PlatformAccountSupply para = new Po6147PlatformAccountSupply();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //收单渠道类型 根据不同收单渠道上送 01-橙E收款 02-跨行快收（非T0） 03-跨行快收（T0） 04-聚合支付 YST1-云收款
            para.setAcquiringChannelType("YST1");
            //订单号 下单时的子订单号，不是总订单号
            para.setOrderNo(orderNo);
            //金额
            para.setAmt(amt);
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"PlatformAccountSupply");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6147PlatformAccountSupply.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6164MemberTransactionRefund Api6164MemberTransactionRefund(String orderNo, String amt) {
        return null;
    }

    @Override
    public Po6007MembershipTrancheFreeze ApiPo6007MembershipTrancheFreeze(String functionFlag, String subAcctNo, String tranNetMemberCode, String tranAmt, String tranCommission, String orderNo, String orderContent) {
        Po6007MembershipTrancheFreeze rtnv = null;
        try{
            PABankSDK.init("conf/config.properties");
            PABankSDK.getInstance().approveDev();

            String CnsmrSeqNo = FakeDataUtil.randomCnsmrSeqNo(sdkProperties.getUid());
            Po6007MembershipTrancheFreeze para = new Po6007MembershipTrancheFreeze();
            para.setCnsmrSeqNo(CnsmrSeqNo);
            para.setMrchCode(sdkProperties.getMrchcode());
            para.setFundSummaryAcctNo(sdkProperties.getFundSummaryAcctNo());

            //功能标志
            /*
            1：冻结（会员→担保）
            2：解冻（担保→会员）
            4：见证+收单的冻结资金解冻
            5: 可提现冻结（会员→担保）
            6: 可提现解冻（担保→会员）
            7: 在途充值解冻（担保→会员）
             */
            para.setFunctionFlag(functionFlag);
            //订单号 下单时的子订单号，不是总订单号
            para.setOrderNo(orderNo);
            //见证子账户的账号
            para.setSubAcctNo(subAcctNo);
            //交易网会员代码
            para.setTranNetMemberCode(tranNetMemberCode);
            //交易金额
            para.setTranAmt(tranAmt);
            //交易手续费
            para.setTranCommission(tranCommission);
            //币种 默认：RMB
            para.setCcy("RMB");
            //订单号
            para.setOrderNo(orderNo);
            //订单内容
            para.setOrderContent(orderContent);
            //备注
            para.setRemark("");
            para.setReservedMsg("");
            String req = para.getReqPara();
            log.info("req:"+req);
            Map<String, Object> returnMap= PABankSDK.getInstance().apiInter(req,"MembershipTrancheFreeze");
            String str_rtnv = JSON.toJSONString(returnMap);
            log.info("returnMap:"+str_rtnv);
            rtnv = JSON.parseObject(str_rtnv,Po6007MembershipTrancheFreeze.class);
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
        }
        return rtnv;
    }

    @Override
    public Po6031PlatformOrderManagement Api6031PlatformOrderManagement(String orderNo, String amt) {
        return null;
    }

}
